Math for Assembly

Submit this sheet with all calculations and all supporting work.

  1. Given the following segment:offset addresses, find the physical address.
Formula:physical address=(segment×16)+offset Formula:\quad physical\ address = (segment\times 16) + offset

(a) 02C1:074F

02C10+074F0335F \begin{aligned} 02C10& \\ +\quad 074F& \\ \overline{0335F}& \end{aligned}

(b) 15C5:4CCF

15C50+4CCF1A91F \begin{aligned} \tt 15C50& \\ +\quad \tt 4CCF& \\ \overline{\tt 1A91F}& \end{aligned}
  1. Given the following physical addresses and offset values, calculate the segment value.
RearrangeFormula:(physical address offset)/16=segment Rearrange \\ Formula:\quad (physical\ address -\ offset) /16 = segment

(a) Physical Address C4AD6, Offset 8AB6

C4AD68AB6BC020 Divided by E means physical address is BC02 \begin{aligned} \tt C4AD6& \\ -\quad \tt 8AB6& \\ \overline{\tt BC020}& \\ \text{ Divided by E means physical address is BC02} \end{aligned}

(b) Physical Address 1B0DC, Offset 007C

1B0DC007C1B060 Divided by E means physical address is 1B06 \begin{aligned} \tt 1B0DC& \\ -\quad \tt 007C& \\ \overline{\tt 1B060}& \\ \text{ Divided by E means physical address is 1B06} \end{aligned}
  1. Convert the following decimal reals to IEEE Single Precision binary.

(a) -9.8
The number is negative number therefore signed with 11
99 in binary is 10011001

0.8×2=1.6=10.6×2=1.2=10.2×2=0.4=00.4×2=0.8=00.8×2=1.6=10.8=0.1100110011001100... \begin{aligned} &0.8 \times 2 = 1.6 = 1\\ &0.6 \times 2 = 1.2 = 1\\ &0.2 \times 2 = 0.4 = 0\\ &0.4 \times 2 = 0.8 = 0\\ &0.8 \times 2 = 1.6 = 1\\ &\\ &0.8 = 0.1100110011001100... \end{aligned}

In normalized form 1.00101×231.00101 \times 2^3
Exponent of 3 needs to add 127 to get 130 which in binary is 100000101000 0010
Thusly -9.8 in floating point binary is 1 10000010 0010 1000 0000 0000 0000 000 \textcolor{khaki}{\text{-9.8 in floating point binary is \boxed{\text{1 10000010 0010 1000 0000 0000 0000 000 }}}}

(b) 12.32
The number is positive number therefore signed with 00
1212 In binary the number is 11001100

0.32×2=0.64=00.64×2=1.28=10.28×2=0.56=00.56×2=1.12=10.12×2=0.24=00.24×2=0.48=00.48×2=0.96=00.96×2=1.92=10.92×2=1.84=10.84×2=1.68=10.68×2=1.36=10.36×2=0.72=00.72×2=1.44=10.44×2=0.88=00.88×2=1.76=10.76×2=1.52=10.52×2=1.04=10.04×2=0.08=00.08×2=0.16=00.16×2=0.32=00.32×2=0.64=00.32=0.010100011110101110000... \begin{align} &0.32 \times 2 = 0.64 = 0\\ &0.64 \times 2 = 1.28 = 1\\ &0.28 \times 2 = 0.56 = 0\\ &0.56 \times 2 = 1.12 = 1\\ &0.12 \times 2 = 0.24 = 0\\ &0.24 \times 2 = 0.48 = 0\\ &0.48 \times 2 = 0.96 = 0\\ &0.96 \times 2 = 1.92 = 1\\ &0.92 \times 2 = 1.84 = 1\\ &0.84 \times 2 = 1.68 = 1\\ &0.68 \times 2 = 1.36 = 1\\ &0.36 \times 2 = 0.72 = 0\\ &0.72 \times 2 = 1.44 = 1\\ &0.44 \times 2 = 0.88 = 0\\ &0.88 \times 2 = 1.76 = 1\\ &0.76 \times 2 = 1.52 = 1\\ &0.52 \times 2 = 1.04 = 1\\ &0.04 \times 2 = 0.08 = 0\\ &0.08 \times 2 = 0.16 = 0\\ &0.16 \times 2 = 0.32 = 0\\ &0.32 \times 2 = 0.64 = 0\\ &\\ &0.32 = 0.010100011110101110000... \end{align}

Exponent of 3 needs to add 127 to get 130 which in binary is 100000101000 0010
In normalized form 1.100010100011110101110000×231. 1000 1010 0011 11010 1110 000 \times 2^3
Thusly 12.32 in floating point binary is 0 10000010 1000 1010 0011 11010 1110 000 \textcolor{khaki}{\text{12.32 in floating point binary is \boxed{\text{0 10000010 1000 1010 0011 11010 1110 000 }}}}

  1. Convert the following IEEE Single Precision binary numbers to decimal real values.
    (a) 1 01111100 1000 0001 1000 1011 1011 100

The number is signed with 11 therefore it is a negative number

Exponent is 0111110001111100 which is

26+25+24+23+2264+32+16+8+4=124\displaystyle \begin{aligned} &\quad 2^6 &+\quad 2^5 &+\quad 2^4 &+\quad 2^3 &+\quad 2^2 \\ &\quad 64 &+\quad 32 &+\quad 16 &+\quad 8 &+\quad 4 \quad= 124 \end{aligned}

\displaystyle

this is biased unbiased is 124127=3124 - 127 = -3

so 1.1000 0001 1000 1011 1011 100×230.0011 0000 0011 0001 0111 0111 00 \text{1.1000 0001 1000 1011 1011 100}\times 2^{-3}\\ \text{0.0011 0000 0011 0001 0111 0111 00} Denormalized binary form

24+29+28+216+218+219+220+222+223+2241 01111100 1000 0001 1000 1011 1011 100in Decimal Form is0.1882547736168 2^{-4} + 2^{-9} + 2^{-8} + 2^{-16} + 2^{-18} + 2^{-19} + 2^{-20} + 2^{-22} + 2^{-23} + 2^{-24}\\ \textcolor{khaki}{\text{1 01111100 1000 0001 1000 1011 1011 100}}\\ \textcolor{khaki}{\text{in Decimal Form is}}\\ \textcolor{khaki}{\boxed{-0.1882547736168}}

(b) 0 10001100 0000 1011 1011 1011 1011 101

The number is signed with 00 therefore it is a positive number

Exponent is 1000110010001100 which is

27+23+22128+8  +4=140\displaystyle \begin{aligned} &\quad 2^7 &+\quad 2^3&+\quad 2^2 \\ &\quad 128 &+\quad 8\ \ &+\quad 4 \quad= 140 \end{aligned}

\displaystyle

this is biased unbiased is 140127=13140 - 127 = 13

so 1.0000 1011 1011 1011 1011 101×21310 0001 0111 0111 . 0111 0111 01 \text{1.0000 1011 1011 1011 1011 101}\times 2^{13}\\ \text{10 0001 0111 0111 . 0111 0111 01} Denormalized binary form

213+28+26+25+24+22+21+20+22+23+24+26+27+28+2100 10001100 0000 1011 1011 1011 1011 101in Decimal Form is8567.2783203125 2^{13} + 2^8 + 2^6 + 2^5 + 2^4 + 2^2 + 2^1 + 2^0 + 2^{-2} + 2^{-3} + 2^{-4} + 2^{-6} + 2^{-7} + 2^{-8} + 2^{-10}\\ \textcolor{khaki}{\text{0 10001100 0000 1011 1011 1011 1011 101}}\\ \textcolor{khaki}{\text{in Decimal Form is}}\\ \textcolor{khaki}{\boxed{8567.2783203125}}